package com.hanmei.lion.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

import com.hanmei.lion.dao.UserInfoDAO;
import com.hanmei.lion.model.UserInfo;

public class UserInfoDAOImpl implements UserInfoDAO {

	private SessionFactory sessionFactory;
	
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	@Override
	public int save(UserInfo userInfo) {
		System.out.println(sessionFactory);
		Session session = sessionFactory.getCurrentSession();
		session.save(userInfo);
		return userInfo.getUserInfoId();
	}

}
